package com.google.coffeeshop.gui.desktop;

import java.awt.Font;

import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.SwingConstants;

import net.sourceforge.jdatepicker.JDateComponentFactory;
import net.sourceforge.jdatepicker.JDatePicker;

import com.google.coffeeshop.gui.desktop.selfcomponent.ImagePanel;
import com.google.coffeeshop.gui.desktop.selfcomponent.MultiColumnsComboBox;


public class SwingFactory {

	static public final String NO_IMAGE_NAME = "no-image.jpg";
	static public final String NO_PRODUCT_IMAGE_NAME = "default-no-image.png";	
	static public JLabel createTitleLabel(String caption) {
		JLabel label = new JLabel();
		label.setText(caption);
		label.setHorizontalAlignment(SwingConstants.CENTER);
		label.setVerticalAlignment(SwingConstants.TOP);
		label.setFont(new Font("Dialog", Font.BOLD, 21));
		return label;
	}
	
	static public JDatePicker createJDatePicker() {
		JDatePicker datePicker = JDateComponentFactory.createJDatePicker();
		return datePicker;
	}
	
	static public void showMessageDiaglogInform(String message) {
		JOptionPane.showMessageDialog(null, message, "System Message", JOptionPane.OK_OPTION, 
				new ImageIcon(SwingFactory.class.getResource("/javax/swing/plaf/metal/icons/Inform.gif")));
	}
	
	static public boolean showConfirmDialog(String message) {
		int result = JOptionPane.showConfirmDialog(null, message, "System Message", JOptionPane.OK_CANCEL_OPTION,
				JOptionPane.WARNING_MESSAGE, new ImageIcon(SwingFactory.class.getResource("/javax/swing/plaf/metal/icons/Inform.gif")));
		return result == JOptionPane.OK_OPTION;
	}

    static public MultiColumnsComboBox createMultiColumnsComboBox() {
    	MultiColumnsComboBox multiColumnsComboBox = new MultiColumnsComboBox();
        return multiColumnsComboBox;
    }
	
    static public ImagePanel createImagePanel(boolean fit) {
    	ImagePanel pnlImage = new ImagePanel(fit);
        return pnlImage;
    }
    
	private SwingFactory() {}
}

